package com.wxq.demo.controller;

import com.wxq.demo.pojo.Book;
import com.wxq.demo.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BookController {

    @Autowired
    private BookService bookService;

    @GetMapping("/test")
    public void test() {
        List<Book> datasourceOne = bookService.findAllBooksFromDataSourceOne();
        List<Book> datasourceTwo = bookService.findAllBooksFromDataSourceTwo();
        for (Book book : datasourceOne) {
            System.out.println("datasourceOne:" + book.getId() + ";" + book.getName() + ";" + book.getAuthor());
        }

        for (Book book : datasourceTwo) {
            System.out.println("datasourceTwo:" + book.getId() + ";" + book.getName() + ";" + book.getAuthor());
        }
    }
}
